#!/bin/bash
clear
rm a.out

echo "Compiling..."
arm-none-eabi-gcc timerled.c startup_gcc.c -g -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -Os -ffunction-sections -fdata-sections -MD -std=c99 -Wall -pedantic -DPART_LM4F120H5QR -c -I/home/atreyu/Source/stellaris/stellarisware -DTARGET_IS_BLIZZARD_RA1

echo "Linking..."
arm-none-eabi-ld -T timerled.ld --entry ResetISR -o a.out startup_gcc.o timerled.o --gc-sections

echo "Copying object files..."
arm-none-eabi-objcopy -O binary a.out timerled.bin

echo "Flashing to rom..."
#lm4flash timerled.bin
sudo ~/Source/stellaris/lm4tools/lm4flash/lm4flash timerled.bin

echo "Build terminated."

#ta info: yuanye@uvic.ca
